Skip to content

Conversation

@AntonOresten
Copy link
Contributor

Ensures the cache stays valid by replacing f, argtypes with the method instance which(f, argtypes) to allow redefinition of kernel methods. This is useful when writing kernels — when writing #16 I actually got all the way up to fmha_kernel95 or something.😅

@AntonOresten
Copy link
Contributor Author

This will still fail when a method called from within the kernel gets updated. Maybe there's a more robust solution, but this would still be useful for now.

@AntonOresten AntonOresten marked this pull request as draft January 13, 2026 19:38
@arhik
Copy link
Contributor

arhik commented Jan 13, 2026

cool.

@AntonOresten AntonOresten marked this pull request as ready for review January 13, 2026 20:00
@AntonOresten AntonOresten marked this pull request as draft January 13, 2026 20:03
@AntonOresten AntonOresten marked this pull request as ready for review January 13, 2026 20:11
@maleadt
Copy link
Member

maleadt commented Jan 13, 2026

This is flawed, but I'll take it for now (if it works). The proper solution is to include the world age much like how GPUCompiler.jl's cache mechanism work.

For testing, you can use a temporary module you @eval things into: https://github.com/JuliaGPU/GPUCompiler.jl/blob/da0be16b92b9126711fc6d4d36dad30d094b758f/test/native.jl#L84-L98

@AntonOresten
Copy link
Contributor Author

AntonOresten commented Jan 13, 2026

Makes sense..

I'm now using a temporary module like you suggested, and there's no method overwrite warning like before, so if this is fine for now, I think it's ready!

@AntonOresten
Copy link
Contributor Author

AntonOresten commented Jan 19, 2026

Instead of throwing a method error, this branch seems to error at which:

ERROR: Calling invoke(f, t, args...) would throw:
MethodError: no method matching ...

This could be caught, and a real MethodError could be thrown I guess.

@maleadt
Copy link
Member

maleadt commented Jan 19, 2026

Let's go ahead and merge this, but know that I'm actually looking into a 'proper' integration with Julia's compiler infrastructure, which will support redefinitions, correct world age handling, and possibly even disk caching.

@maleadt maleadt merged commit ac2a860 into JuliaGPU:main Jan 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants